#include <iostream>
#include "Actor.h"

int main()
{
    Calculator cal;

    // 发送加法任务
    auto f1 = cal.calculator([](int a, int b) { return a + b; }, 3, 4);

    // 发送乘法任务
    auto f2 = cal.calculator([](int a, int b) { return a * b; }, 6, 7);

    // 发送浮点数乘法任务
    auto f3 = cal.calculator([](double a, double b, double c) { return a * b * c; }, 2.5, 3.0, 4.0);

    // 输出计算结果
    try
    {
        std::cout << "3 + 4 = " << f1.get() << "\n";
        std::cout << "6 * 7 = " << f2.get() << "\n";
        std::cout << "2.5 * 3.0 * 4.0 = " << f3.get() << "\n";
    }
    catch (const std::exception& e)
    {
        std::cerr << "Exception: " << e.what() << std::endl;
    }
    catch (...)
    {
        std::cerr << "Unknown exception" << std::endl;
    }

    return 0;
}